package com.example.iitematicviewer.util.fileDownLoad;

import com.alibaba.fastjson.JSONObject;
import com.example.iitematicviewer.vo.ResultVO;
import jdk.nashorn.internal.runtime.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RequestMapping("/fileDownLoad")
@RestController
public class FileDownLoadController {

    @Autowired
    private FileDownLoadService service;

    @Autowired
    private FileDownLoadSaveService saveService;

    @RequestMapping("/down")
    public void down(String outFilePath,String file_name){
        ResultVO resultVO = new ResultVO();
        /*String fileName = request.getParameter(FileDownLoadConstant.filename);
        String fileFormat = fileName.substring(fileName.lastIndexOf("."));*/
        String fileFormat = file_name.substring(file_name.lastIndexOf("."));
        if (!fileFormat.equals("jpg") || !fileFormat.equals("png")){
            saveService.saveUrlAs(file_name,"D:\\file\\客户.txt","张三","POST");
        }
        /*else{
            service.down(request,response,resultVO);
        }*/
    }

}
